<?php

/**
 * Project form base class.
 *
 * @package    lomejorde
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormBaseTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
abstract class BaseFormDoctrine extends sfFormDoctrine
{
    public function setup()
    {
    }
    
    public static function _formValuesAreBlank(array $fieldNames, array $values)
    {
        foreach ($fieldNames as $fieldName)
        {
            if (isset($values[$fieldName]) && !self::formValueIsBlank($values[$fieldName]))
            {
                return false;
            }
        }

        return true;
    }

    public static function formValueIsBlank($value)
    {
        if (is_array($value)){
            foreach ($value as $subValue)
            {
                if (!self::formValueIsBlank($subValue)) 
                {
                    return false;
                }
            }

            return true;
        }

        return $value ? false : true;
    }
}
